package com.econ.powercloud.ems.controller;

import com.econ.powercloud.common.base.facade.pojo.MsgResult;
import com.econ.powercloud.ems.common.enums.CalLocationType;
import com.econ.powercloud.ems.pojo.ForecastThreeChartVO;
import com.econ.powercloud.ems.pojo.ForecastTwoChartVO;
import com.econ.powercloud.ems.service.biz.EnergyStationForecastService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author jwc
 * @date 2022/11/21
 */
@Api(tags = "储能站预测数据")
@RestController
@RequestMapping(value = "/api/v2/energyStationForecast")
@RequiredArgsConstructor
public class EnergyStationForecastController extends ApiBaseController{
    private final EnergyStationForecastService energyStationForecastService;

    @ApiOperation("获取全站有功功率图的数据")
    @GetMapping("activePower")
    public MsgResult<ForecastThreeChartVO> activePower() {
        return successHandler(energyStationForecastService.getThreeChartData(CalLocationType.ACTIVE_POWER));
    }

    @ApiOperation("获取全站无功电压图的数据")
    @GetMapping("reactiveVoltage")
    public MsgResult<ForecastThreeChartVO> reactiveVoltage() {
        return successHandler(energyStationForecastService.getThreeChartData(CalLocationType.REACTIVE_VOLTAGE));
    }

    @ApiOperation("获取辅助设备有功功率图的数据")
    @GetMapping("aidActivePower")
    public MsgResult<ForecastThreeChartVO> aidActivePower() {
        return successHandler(energyStationForecastService.getThreeChartData(CalLocationType.AID_ACTIVE_POWER));
    }

    @ApiOperation("获取全站充放电量图的数据")
    @GetMapping("chargeDischargeCapacity")
    public MsgResult<ForecastTwoChartVO> chargeDischargeCapacity() {
        return successHandler(energyStationForecastService.getChartData(CalLocationType.CHARGE_DISCHARGE_CAPACITY));
    }

    @ApiOperation("获取辅助设备用电量图的数据")
    @GetMapping("aidPowerConsumption")
    public MsgResult<ForecastTwoChartVO> aidPowerConsumption() {
        return successHandler(energyStationForecastService.getChartData(CalLocationType.AID_POWER_CONSUMPTION));
    }

}
